package com.sola.mybatis.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.sola.mybatis.entity.User;

@Mapper
public interface UserMapper {

	@Insert("INSERT into user(id,name,password,birthday,address) VALUES(#{id},#{name},#{password},#{birthday},#{address})")
	public int add(User user);
	
	@Update("update user set name = #{name} where id = #{id}")
	public int update(User user);
	
	@Delete("delete from user where id = #{id}")
	public int delete(String id);
	
	@Select("select id,name,password,birthday,address from user where id = #{id}")
	public User getUserById(String id);
	
	@Select("select id,name,password,birthday,address from user")
	public List<User> getUserList();
	
}
